import axios from 'axios'
const http = {

};
axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    //window.localStorage.getItem("accessToken") 获取token的value
    let token = window.sessionStorage.getItem("userToken")
    if (token) {
        //将token放到请求头发送给服务器,将tokenkey放在请求头中
        config.headers.userToken = token;
        //也可以这种写法
        // config.headers['accessToken'] = Token;
    }
    return config;
}, function (error) {
    // Do something with request error
    return Promise.reject(error);
});
//塔吊表1
http.TaDiaobiao1 = params => axios.post("/api/chaiFen/Tower", params).then(r => r.data)
//监控大屏大图下面的工程进度
http.getNodeDates = params => axios.post("/api/buildNode/getNodeDates", params).then(r => r.data)
// 监控大屏倒计时  buildInfo/getBuildDate
http.getBuildDate = params => axios.post("/api/buildInfo/getBuildDate", params).then(r => r.data)

//登录
http.userLogin = params => axios.post("/api/buildApp/login", params).then(r => r.data)
// 环境图
http.huanjing1chart = params => axios.post("/api/chaiFen/Weather", params).then(r => r.data)
// // 个人中心
http.getBuildPeople = params => axios.post("/api/buildAdmin/getBuildPeople", params).then(r => r.data)
// 个人中心2
http.getBuildAdmin = params => axios.post("/api/buildAdmin/getBuildAdmin", params).then(r => r.data)
// 监控大屏的第三部分车辆数据
http.getBuildCarList = params => axios.post("/api/buildLargeScreen/getBuildCarList", params).then(r => r.data)
// http.userLogin = params => axios.post("/api/buildAdmin/login", params).then(r => r.data);

//环境监测数值
http.ygetBuildWeatherList = params => axios.post("/api/buildLargeScreen/getBuildWeatherList", params).then(r => r.data)
// 环境监测下拉框
http.hujList= params => axios.post("/api/buildLargeScreen/getBuildWeatherNameList", params).then(r => r.data)
// 环境图
http.huanjing1chart = params => axios.post("/api/chaiFen/Weather", params).then(r => r.data);
 //塔吊
http.tower = params => axios.post("/api/buildLargeScreen/getBuildTowerList", params).then(r => r.data);
// ===车辆监控系统===
http.lineage  = params => axios.post("/api/buildCarinfo/sel", params).then(r => r.data)//车辆信息
// 监控大屏的第三部分人员考勤数据
http.getBuildAttendanceNow = params => axios.post("/api/buildAttendance/getBuildAttendanceNow", params).then(r => r.data)
// f 人员考勤
http.getBuildAttendanceList = params => axios.post("/api/buildAttendance/getBuildAttendanceList", params).then(r => r.data)

// 监控大屏的预警监测里的自动向上数据 buildLargeScreen/getAlarminfoNum
http.getAlarminfoNum = params => axios.post("/api/buildLargeScreen/getAlarminfoNum", params).then(r => r.data)
// 塔吊设备数据接口
http.getTowerNum  = params => axios.post("/api/buildConsole/getTowerNum", params).then(r => r.data)
// 环境监测设备数据接口
http.getWeatherNum  = params => axios.post("/api/buildConsole/getWeatherNum", params).then(r => r.data)
// 环境监控设备数据接口
http.getMonitorNum  = params => axios.post("/api/buildConsole/getMonitorNum", params).then(r => r.data)

// 基坑下拉
http.jkList= params => axios.post("/api/buildLargeScreen/getBuildPitNameList", params).then(r => r.data)
//基坑数值
http.ygetBuildPitList= params => axios.post("/api/buildLargeScreen/getBuildPitList", params).then(r => r.data)
export default http